package eco2automotive.Log;
import eco2automotive.util.TimeControl;
 /**  
  * Storage of the TX and RX information 
  * @autor Fco. Javier Sánchez Esparza
  * @version 1.0
  *
  */ 
public class TXRXInformation {

    StringBuffer infoRX;
    StringBuffer infoTX;
    /** 
     * Create RX and TX StringBuffer
     */
    public TXRXInformation(){
        infoRX=new StringBuffer();
        infoTX=new StringBuffer();
    }
    /** 
     * Return String
     * @return String that contains the RX inforamation
     */    
    public String getRXInformation (){        
        return this.infoRX.toString();}
    /** 
     * Add the string recived to the register
     * @param s String to append in RX information
     */
    public void addRXInformation(String s){
    String d=new TimeControl().getFormated();
    s="\n>\n"+d+"\n"+s+"\n<";
    infoRX=infoRX.append(s);
    }    
 
    /** 
     * Return a String
     * @return String that contains the TX inforamation
     */    
    public String getTXInformation (){        
        return this.infoTX.toString();}
    /** 
     * Add the string recived to the register
     * @param s String to append in TX information
     */
    public void addTXInformation(String s){
    String d=new TimeControl().getFormated();
    s="\n>\n"+d+"\n"+s+"\n<";
    infoTX=infoTX.append(s);
    }
    /** 
     * Clear the data sotored in the String infoRX and String infoTX
     */
    public void clear(){
        this.infoRX=new StringBuffer(); 
        this.infoTX=new StringBuffer();
    } 
}